package com.ffyc.cemp.tools;

import com.huaban.analysis.jieba.JiebaSegmenter;

import java.util.Iterator;
import java.util.List;

/**
 * 分词工具类
 */
public class WordsUtil {

    public static List<String> toWorlds(String sentence) {
        JiebaSegmenter js = new JiebaSegmenter();
        List<String> list = js.sentenceProcess(sentence);
        //删掉List集合中的数据
        Iterator<String> it = list.iterator(); //迭代器

        while (it.hasNext()) {
            String str = it.next(); //集合中获取数据
            if (str.matches("[\\pP\\p{S}的得呢了吗和]|[0-9]")) {
                it.remove();
            }
        }
        return list;
    }

}
